package day03

/**
  * 偏函数(没有match 只有case的方法)
  */
class PartialFunctionDemo {

}
object PartialFunctionDemo{
  def main(args: Array[String]): Unit = {

  }

  def func1:PartialFunction[String,Int] ={
    case "one" =>{
      println("one case")
      1
    }
    case "two" => 2
    case _ => -1
  }


  /**
    * 普通的方法
    * @param num
    * @return
    */
  def func2(num:String) :Int = num match {
    case "one" => 1
    case "two" => 2
    case _ => -1

  }
}
